<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 100px;
            height: 100px;
            background: red;
        }
        .active{
            color: white;
        }
        
    </style>
</head>
<body>
    <div class="box">hello</div>
    <button>点击</button>
    <button>点击</button>
</body>
</html>
<script>
    var ele = document.querySelector(".box");
    ele.onclick = function(){
        this.classList.add("active");
        var btns = document.querySelectorAll("button");
        btns[0].onclk = function(){
            ele.classList.remove("active");
        [

        ]}
        btns[1].onclick = function() {
            var res = ele.classList.contain("active");
            console.log(res);
        }
    }
</script>